﻿namespace ClassyBlog.Infrastructure
{
    using System;

    public static class ServiceContainerExtensions
    {
        public static TService Resolve<TService>(
            this IServiceContainer instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }

            var result = (TService)instance.Resolve(typeof(TService));

            return result;
        }
    }
}